use std::{path::PathBuf, time::Duration};

// Note that we can simply auto-derive Default here.
#[derive(Default, Debug, PartialEq)]
struct MyConfiguration {
    // Option defaults to None.
    output: Option<PathBuf>,
    // Vecs default to an empty vector.
    search_path: Vec<PathBuf>,
    // Duration defaults to zero time.
    timeout: Duration,
    // bool defaults to false.
    check: bool,
}

impl MyConfiguration {
    // Add setters here.
}

fn main() {
    #[allow(clippy::field_reassign_with_default)]
    let conf = {
        // Construct a new instance with default values.
        let mut conf = MyConfiguration::default();
        // Do something with the config here.
        conf.check = true;
        println!("conf = {conf:#?}");

        conf
    };
    let another_conf = {
        // Partial initialization with default values, creates an equal instance.
        let another_conf = MyConfiguration {
            check: true,
            ..Default::default()
        };
        println!("another_conf = {another_conf:#?}");

        another_conf
    };

    assert_eq!(conf, another_conf);
}
